'use strict';

const Controller = require('egg').Controller;

class CreateprojectController extends Controller {
  async createProject() {
    const { ctx } = this
    const { project_name, project_desc, project_pm, project_programmer } = ctx.request.body
    const result = await ctx.service.projectlist.createProject(project_name, project_desc, project_pm, project_programmer)
    console.log(result.affectedRows)
    if (result.affectedRows === 1) {
      ctx.body = {
        code: 1,
        msg: '添加成功'
      }
      return
    }
    ctx.body = {
      code: 0,
      msg: '添加失败,请重新尝试'
    }
  }
}

module.exports = CreateprojectController;
